<template>
  <div style="margin: 20px;" v-loading.lock="loading" element-loading-text="加载中..."
    element-loading-spinner="el-icon-loading">
  </div>
</template>

<script>
  import {
    mapGetters
  } from 'vuex'

  export default {
    data() {
      return {
        loading: false,
      }
    },
    computed: {
      ...mapGetters([
        'menus'
      ]),
    },
    mounted() {
      this.showCurrLoading();
    },
    methods: {
      showCurrLoading() {
        this.loading = true;
        setTimeout(() => {
          this.loading = false;
        }, 2000);

        //跳转到第一个菜单
        var menu = this.menus[0];
        var path = '';
        if (menu.hasOwnProperty('children') && menu.children.length > 0) {
          path = menu.children[0].index;
        } else {
          path = menu.index;
        }
        this.$router.push({
          path
        });

      },
    }
  }
</script>

<style>

</style>
